import {
    followUp,
    centerEdit,
    formTimeLine,
    formInput,
    centerHeader,
    centerEditPad
} from '@/css/DialogsCss.module.scss';
export default {
    title:'新增跟进记录',
    dialog:{
        size:'50%'
    },
    onMounted: [{
        action:'print',
        value:'$params'
    },{
        action:'set',
        target: '$view',
        field:'title',
        value:'$params.title'
    },{
        action: 'set',
        target: '$widgets.formbasic',
        field: 'value',
        value: '$params.form'
    },{
        action: 'set',
        target: '$widgets.form',
        field: 'value',
        value: '$params.form'
    }],
    items: [{
        region: 'center',
        class: followUp,
        layout: 'vertical',
        items: [{
            class: [centerEdit, centerEditPad],
            items:[{
                id: 'formbasic',
                widget: 'form',
                layout: 'gridform',
                fields:[{
                    itemId:'customer_uuid',
                    widget:'select',
                    print: true,
                    dictionary: 'common/dictionary/customer',
                    label:'客户(公司)',
                }],
            },{
                id: 'form',
                widget: 'form',
                layout: {
                    type:'gridform',
                    column:1
                },
                fields:[{
                    itemId: 'last_follow_time',
                    placeholder:'请选择跟进时间',
                    widget:'form-datepicker',
                    type: 'date',
                    label:'跟进时间',
                },{
                    itemId: 'remarks',
                    placeholder:'请输入备注说明',
                    widget:'text',
                    label:'备注说明',
                }],
                buttons: [{
                    value: '保存',
                    type: 'primary',
                    onClick: [{
                        action: 'confirm',
                        title: '表单保存',
                        message: '是否保存表单?',
                        confirm: [{
                            action: 'service',
                            path: 'crm/contacts/save',
                            params: '$widget.value'
                        }, {
                            action: 'message',
                            message: '保存成功',
                            type: 'success'
                        },{
                            action:'call',
                            target:'$widget',
                            method:'reload'
                        },{
                            action:'dialog-hide',
                            mode:'apply'
                        }]
                    }]
                }],
            }]
        },{
            class: [centerEdit, formTimeLine, centerHeader],
            items:[{ 
                class: formInput,
                id: 'title',
                widget: 'public-title',
                title: '跟进记录',
            },{
                class: centerEditPad,
                id: 'timeline',
                widget: 'data-timeline',
                field: 'items',
                enableCard:true,
                enableTitle:false,
                service: {
                    path: 'crm/potential/record/list',
                    params: {
                        type: 2,
                    },
                },
                // dictionary: 'common/dictionary/log',
                placement:'top',
                items: [{
                    timestamp: 'create_time',
                    size: 'large',
                    type: 'primary',
                    text:"contents"
                }],
                flex: true
            }]
        }],
    }]
};


